package com.kingyun.gpsinspection.purificationservice.services.activitiservice.ext.listener;

import com.kingyun.gpsinspection.purificationservice.common.activiti.ActivitiConstants;
import org.activiti.engine.delegate.DelegateTask;
import org.activiti.engine.delegate.TaskListener;
import org.activiti.engine.impl.persistence.entity.TaskEntity;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * 自动完成任务监听器类
 */
public class AutoCompleteTaskListener implements TaskListener {

    private static Logger logger = LoggerFactory.getLogger(AutoCompleteTaskListener.class);


    @Override
    public void notify(DelegateTask delegateTask) {
        String assignee = delegateTask.getAssignee();



        //自动完成任务
        if(ActivitiConstants.AUTO_COMPLETE_ASSIGN.equals(assignee)){
            ((TaskEntity)delegateTask).complete(null,true);
        }
    }
}
